<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		
		<!-- 引入vue -->
		<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
	</head>
	<body>
		<!-- 设计模式(MVVM模式) Model-View-View-Model  -->
		<!-- vue 就是 相当于中间View-Model 负责自动将Model中的数据绑定到视图中 -->
		
		<!-- View -->
		<div id="app">
			{{msg}}<br />
			<button @click="add">{{count}}</button>
		</div>
		
		<script type="text/javascript">
			
			// View-Model
			const vm = Vue.createApp(
				{
					
					data(){
						return {
							msg:"Hello world,Vue!",
							count: 0
						}
					},
					
					methods:{
						add()
						{
							console.log("add()")
							this.count++;
						}
					}
				}
			)
			vm.mount("#app")
		</script>
		
	</body>
</html>
